package com.abc.robot01.activity


import android.app.Activity
import android.util.Log
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.LinearLayout
import android.widget.ScrollView
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicText
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.viewinterop.AndroidView
import androidx.compose.ui.window.Dialog
import com.abc.robot01.R

@Composable
fun TwoStateButton(
    isSelected: MutableState<String>,
    text: String,
    size: DpSize = DpSize(144.px, 44.px),
    fontSize: TextUnit = MyFont_Size,
    onClick: (tag: String) -> Unit
) {
    val isSelectedButton = isSelected.value == text
    val cardColor = if (isSelectedButton) MYBLUE else MYBLACK_Percent5
    val textColor = if (isSelectedButton) Color.White else MYBLACK

    Box(
        modifier = Modifier
            .size(size)
            .background(cardColor, shape = RectangleShape)
            .clickable {
                isSelected.value = text
                onClick(text)
            },
        contentAlignment = Alignment.Center
    )
    {
        Text(
            text = text,
            fontWeight = FontWeight.Normal,
            fontSize = fontSize,
            color = textColor,
            maxLines = 1 // Ensure the text stays on one line
        )
    }
}

@Composable
fun MyButton01(
    alpha :Float = 1.0f,
    modifier: Modifier = Modifier,
    text: String,
    containerColor: Color = MYBLACK_Percent5,
    shape: Shape = ButtonDefaults.shape,
    textColor: Color = Color.White,
    size: DpSize = DpSize(144.px, 44.px),
    fontSize: TextUnit = MyFont_Size,
    onClick: (String) -> Unit = {}
) {
    Button(
        onClick = { onClick(text) },
        colors = ButtonDefaults.buttonColors(
            containerColor = containerColor,
            contentColor = textColor
        ),
        shape = shape,
        modifier = modifier.size(size).alpha(alpha),
        contentPadding = PaddingValues(0.dp),
    ) {
        BasicText(
            text = text,
            style = TextStyle(
                fontSize = fontSize,
                color = textColor,
            )
        )
    }
}

/**
 * 钱包页面定制
 */
@Composable
fun MyButton02(
    modifier: Modifier = Modifier, text: String,
    containerColor: Color = MYBLACK_Percent5,
    shape: Shape = ButtonDefaults.shape,
    textColor: Color = Color.White,
    size: DpSize = DpSize(144.px, 44.px),
    fontSize: TextUnit = MyFont_Size,
    click: (String) -> Unit = {}
) {
    Button(
        contentPadding = PaddingValues(
            start = 0.dp,
            top = 0.dp,
            end = 0.dp,
            bottom = 0.dp
        ),
        onClick = { click(text) },
        colors = ButtonDefaults.buttonColors(
            containerColor = containerColor,
            contentColor = textColor
        ),
        shape = shape,
        modifier = modifier.size(size)
    ) {
        Text(
            text = buildAnnotatedString {
                withStyle(style = SpanStyle(fontSize = 42.mysp, color = textColor)) {
                    append(text)
                }
                append("")
                withStyle(style = SpanStyle(fontSize = 22.mysp, color = textColor)) {
                    append("元")
                }
            }
        )
    }
}

/**
 *  系统设置页面
 */
@Composable
fun SystemFragmentBackground(topStart:Dp = 0.px,content: @Composable BoxScope.() -> Unit) {
    Box(
        modifier = Modifier
            .fillMaxSize()
            .padding(start = 30.px, end = 30.px, top = 0.px, bottom = 30.px)
            .background(
                Color.White,
                shape = RoundedCornerShape(
                    topStart = topStart, topEnd = 40.px,
                    bottomStart = 40.px, bottomEnd = 40.px
                )
            )
    ) {
        content()
    }
}


/**
 *  系统设置页面
 */
@Composable
fun SystemFragmentBackground2(topStart:Dp = 0.px,content: @Composable BoxScope.() -> Unit) {
    Box(
        modifier = Modifier.size(1920.px,880.px)
            .padding(start = 30.px, end = 30.px, top = 0.px, bottom = 0.px)
            .background(
                Color.White,
                shape = RoundedCornerShape(
                    topStart = topStart, topEnd = 40.px,
                    bottomStart = 40.px, bottomEnd = 40.px
                )
            )
    ) {
        content()
    }
}


/**
 *  系统设置页面
 */
@Composable
fun SystemFragmentBackground3(topStart:Dp = 0.px,content: @Composable BoxScope.() -> Unit) {
    Box(
        modifier = Modifier.fillMaxSize()
            .padding(start = 0.px, end = 0.px, top = 0.px, bottom = 0.px)
            .background(
                Color.White,
                shape = RoundedCornerShape(
                    topStart = topStart, topEnd = 40.px,
                    bottomStart = 40.px, bottomEnd = 40.px
                )
            )
    ) {
        content()
    }
}



/**
 *   商品详情界面使用
 */
@Composable
fun MyCard(content: @Composable BoxScope.() -> Unit) {
    Box(
        modifier = Modifier
            .fillMaxSize()
            .padding(start = 30.px, end = 30.px, top = 0.px, bottom = 0.px)
            .background(
                Color.White,
                shape = RoundedCornerShape(
                    topStart = 40.px, topEnd = 40.px,
                    bottomStart = 0.px, bottomEnd = 0.px
                )
            )
    ) {
        content()
    }
}

/**
 *   末尾有一個平方米的文字
 */
@Composable
fun CustomStyledTextField3(
    text: MutableState<String>,
    size: DpSize = DpSize(374.px, 50.px),
    fontSize: TextUnit = MyFont_Size,
    placeHolder: String = "请输入",
    click: ((String) -> Unit) = {}
) {
//    var text by remember { mutableStateOf("") }
    // Define the text style with desired font size
    val textStyle = TextStyle(
        fontSize = fontSize, // Set the font size here
//        fontWeight = FontWeight.Thin // You can adjust font weight as needed
    )

    Box(
        contentAlignment = Alignment.Center,
        modifier = Modifier
            .size(size)
            .background(Color(0x66ffffff), shape = RoundedCornerShape(15))
//            .border(1.dp, Color.Gray, shape = RoundedCornerShape(1.dp))
            .padding(1.dp)
            .padding(start = 2.dp)
    ) {
        // Placeholder text
        if (text.value.isEmpty()) {
            Text(
                modifier = Modifier.align(Alignment.CenterStart),
                text = placeHolder,
                style = TextStyle(color = Color.Gray, fontSize = MyFont_Size)
            )
        }

        BasicTextField(keyboardOptions = KeyboardOptions.Default.copy(
            keyboardType = KeyboardType.Number
        ),
            textStyle = textStyle,
            value = text.value,
            onValueChange = {
                text.value = it
            },
            cursorBrush = SolidColor(Color.Black),
            singleLine = true,
            decorationBox = { innerTextField ->
                Row(
                    verticalAlignment = Alignment.CenterVertically
                ) {
                    // Place the text field
                    Box(modifier = Modifier.weight(1f)) {
                        innerTextField()
                    }
                    // Add an icon at the end
                    if (1 == 1) {
                        Box(
                            modifier = Modifier
                                .background(
                                    Color.Transparent,
                                    shape = RoundedCornerShape(15)
                                )
                        )
                        {
                            BasicText(
                                text = "m2",
                                style = TextStyle(
                                    fontSize = MyFont_Size,
                                    color = MYBLACK_Percent60
                                ),
                            )
                        }
                    }
                }
            }
        )
    }
}

@Composable
fun CustomStyledTextField2(
    text: MutableState<String>,
    size: DpSize = DpSize(374.px, 50.px),
    fontSize: TextUnit = MyFont_Size,
    placeHolder: String = "请输入",
    textColor: Color = Color(0x66ffffff),
    click: ((String) -> Unit) = {}
) {
    val textStyle = TextStyle(
        fontSize = fontSize, // Set the font size here
//        fontWeight = FontWeight.Thin // You can adjust font weight as needed
    )

    Box(
        contentAlignment = Alignment.Center,
        modifier = Modifier
            .size(size)
            .background(textColor, shape = RoundedCornerShape(15))
//            .border(1.dp, Color.Gray, shape = RoundedCornerShape(1.dp))
            .padding(1.dp)
            .padding(start = 2.dp)
    ) {
        // Placeholder text
        if (text.value.isEmpty()) {
            Text(
                modifier = Modifier.align(Alignment.CenterStart),
                text = placeHolder,
                style = TextStyle(color = Color.Gray, fontSize = MyFont_Size)
            )
        }

        BasicTextField(
            textStyle = textStyle,
            value = text.value,
            onValueChange = {
                text.value = it
            },
            cursorBrush = SolidColor(Color.Black),
            singleLine = true,
            decorationBox = { innerTextField ->
                Row(
                    verticalAlignment = Alignment.CenterVertically
                ) {
                    // Place the text field
                    Box(modifier = Modifier.weight(1f)) {
                        innerTextField()
                    }
                }
            }
        )
    }
}

@Composable
fun CustomStyledTextField3(
    keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
    last: String,
    text: MutableState<String>,
    size: DpSize = DpSize(200.px, 50.px),
    fontSize: TextUnit = MyFont_Size,
    placeHolder: String = "请输入",
    textColor: Color = Color(0x66ffffff),
    click: ((String) -> Unit) = {}
) {
//    var text by remember { mutableStateOf("") }
    // Define the text style with desired font size
    val textStyle = TextStyle(
        color = textColor,
        fontSize = fontSize, // Set the font size here
//        fontWeight = FontWeight.Thin // You can adjust font weight as needed
    )

    Box(
        contentAlignment = Alignment.Center,
        modifier = Modifier
            .size(size)
            .background(MYBLACK_Percent5, shape = RoundedCornerShape(15))
//            .border(1.dp, Color.Gray, shape = RoundedCornerShape(1.dp))
            .padding(1.dp)
            .padding(start = 2.dp)
    ) {
        // Placeholder text
        if (text.value.isEmpty()) {
            Text(
                modifier = Modifier.align(Alignment.CenterStart),
                text = placeHolder,
                style = TextStyle(color = Color.Gray, fontSize = MyFont_Size)
            )
        }

        BasicTextField(
            keyboardOptions = keyboardOptions,

            textStyle = textStyle,
            value = text.value,
            onValueChange = {
                text.value = it
            },
            cursorBrush = SolidColor(Color.Black),
            singleLine = true,
            decorationBox = { innerTextField ->
                Row(
                    verticalAlignment = Alignment.CenterVertically
                ) {
                    // Place the text field
                    Box(modifier = Modifier.weight(1f)) {
                        innerTextField()
                    }
                    // Add an icon at the end
                    if (1 == 1) {
                        Text(
                            text = last,
                            style = TextStyle(color = textColor, fontSize = MyFont_Size)
                        )
                    }
                }
            }
        )
    }
}

/**
 *   末尾有一个向下的箭头
 */
@Composable
fun CustomStyledTextField4(
    text: MutableState<String>,
    size: DpSize = DpSize(374.px, 50.px),
    fontSize: TextUnit = MyFont_Size,
    placeHolder: String = "请输入",
    textColor: Color = Color(0x66ffffff),
    click: () -> Unit = {}
) {
    Box(
        contentAlignment = Alignment.Center,
        modifier = Modifier
            .clickable {
                click()
            }
            .size(size)
            .background(textColor, shape = RoundedCornerShape(15))
//            .border(1.dp, Color.Gray, shape = RoundedCornerShape(1.dp))
            .padding(1.dp)
            .padding(start = 2.dp, end = 20.px)
    ) {
        Text(
            modifier = Modifier.align(Alignment.CenterStart),
            text = text.value,
            style = TextStyle(color = Color.Gray, fontSize = MyFont_Size)
        )
        Image(
            painter = painterResource(id = R.drawable.down2),
            contentDescription = "",
            modifier = Modifier
                .size(18.px)
                .align(Alignment.CenterEnd)
        )
    }
}

@Composable
fun CustomStyledTextField20(
    text: String,
    size: DpSize = DpSize(374.px, 50.px),
    fontSize: TextUnit = MyFont_Size,
    placeHolder: String,
    onValueChange: ((String) -> Unit) = {}
) {
//    var text  =  remember { mutableStateOf("") }
    // Define the text style with desired font size
    val textStyle = TextStyle(
        fontSize = fontSize, // Set the font size here
//        fontWeight = FontWeight.Thin // You can adjust font weight as needed
    )

    Box(
        contentAlignment = Alignment.Center,
        modifier = Modifier
            .size(size)
            .background(Color(0x66ffffff), shape = RoundedCornerShape(15))
//            .border(1.dp, Color.Gray, shape = RoundedCornerShape(1.dp))
            .padding(1.dp)
            .padding(start = 2.dp)
    ) {
        // Placeholder text
        if (text.isEmpty()) {
            Text(
                modifier = Modifier.align(Alignment.CenterStart),
                text = placeHolder,
                style = TextStyle(color = Color.Gray, fontSize = MyFont_Size)
            )
        }

        BasicTextField(
            modifier = Modifier
                .focusable()
                .onFocusChanged {
//                    if (it.isFocused) {
//                        LocalSoftwareKeyboardController.current.show()
//                    }
                },
            textStyle = textStyle,
            value = text,
            onValueChange = {
                onValueChange(it)
            },
            cursorBrush = SolidColor(Color.Black),
            singleLine = true,
            maxLines = 1,
            decorationBox = { innerTextField ->
                Row(
                    verticalAlignment = Alignment.CenterVertically
                ) {
                    // Place the text field
                    Box(modifier = Modifier.weight(1f)) {
                        innerTextField()
                    }
                }
            }
        )
    }
}


@Composable
fun CustomStyledTextField(
    text1: String = "", singleLine: Boolean = true,
    size: DpSize = DpSize(374.px, 50.px),
    onValueChange: (String) -> Unit = {},
    fontSize: TextUnit = MyFont_Size,
    placeHolder: String,
    search: Boolean = true, click: ((String) -> Unit) = {}
) {
    Log.e("CustomStyledTextField", "text.value: ${text1}");

    var text = remember { mutableStateOf(text1) }
    // Define the text style with desired font size
    val textStyle = TextStyle(
        fontSize = fontSize, // Set the font size here
//        fontWeight = FontWeight.Thin // You can adjust font weight as needed
    )

    Box(
        contentAlignment = Alignment.Center,
        modifier = Modifier
            .size(size)
            .background(MYWhilte_Percent40, shape = RoundedCornerShape(10.px))
            .padding(1.dp)
            .padding(start = 20.px)
    ) {
        // Placeholder text
        if (text.value.isEmpty()) {
            Text(
                modifier = Modifier.align(Alignment.CenterStart),
                text = placeHolder,
                style = TextStyle(color = Color.Gray, fontSize = MyFont_Size)
            )
        }

        BasicTextField(
            modifier = Modifier
                .focusable(),
            textStyle = textStyle,
            value = text.value,
            onValueChange = {
                Log.e(" onValueChange", "onValueChange $it");
                text.value = it
                onValueChange(it)
            },
            cursorBrush = SolidColor(Color.Black),
            //如果要修改,必须要另外复制一个出来.
            singleLine = singleLine,
            maxLines = if (singleLine) 1 else 500,
            decorationBox = { innerTextField ->
                Row(
                    verticalAlignment = Alignment.CenterVertically
                ) {
                    // Place the text field
                    Box(modifier = Modifier.weight(1f)) {
                        innerTextField()
                    }
                    if (search) {
                        // Add an icon at the end
                        Box(
                            modifier = Modifier
                                .background(
                                   color = MYBLUE,
                                    shape = RoundedCornerShape(8.px)
                                ).size(70.px,42.px)
                                .clickable { click(text.value) }) {
                            Image(
                                modifier = Modifier.align(Alignment.Center),
                                painter = painterResource(id = R.drawable.sss),
                                contentDescription = "1"
                            )
                        }
                    }
                }
            }
        )
    }
}

@Composable
fun BoxScope.BottomBar(show:Boolean= true,selected1: Boolean = false,selected2: Boolean = false,onClick: () -> Unit,onClick2: () -> Unit,onClick3: () -> Unit={}) {
    Row(
        modifier = Modifier
            .align(Alignment.BottomCenter)
            .fillMaxWidth()
            .background(Color.White)
            .padding(end = 30.px)
            .height(84.px), // 设置行的高度为100dp
        verticalAlignment = Alignment.CenterVertically // 设置垂直居中
    ) {
        Spacer(modifier = Modifier.weight(100f))
        if(show) {
            MyButton01(
                text = "取消",
                containerColor = MYBLACK_Percent10,
                textColor = MYBLACK,
                size = DpSize(164.px, 44.px),
                shape = RoundedCornerShape(6.px)
            ) {
                onClick3()
            }
            Spacer(modifier = Modifier.width(20.px))
        }
        MyButton01(
            alpha = if(selected1) 1.0f else 0.6f ,
            text = "户型数据",
            containerColor =  MYBLUE ,
            textColor = Color.White,
            size = DpSize(164.px, 44.px),
            shape = RoundedCornerShape(6.px)
        ) {
            onClick2()
        }
        Spacer(modifier = Modifier.width(20.px))
        MyButton01(
            alpha = if(selected2) 1.0f else 0.6f ,
            text = "识别",
            containerColor =  MYBLUE ,
            textColor = Color.White,
            size = DpSize(164.px, 44.px),
            shape = RoundedCornerShape(6.px)
        ) {
            onClick()
        }
    }
}

@Composable
fun BoxScope.BottomBar2(show:Boolean= true,selected1: Boolean = false,selected2: Boolean = false,onClick: () -> Unit,onClick2: () -> Unit) {
    Row(
        modifier = Modifier
            .align(Alignment.BottomCenter)
            .fillMaxWidth()
            .background(Color.White)
            .padding(end = 30.px)
            .height(84.px), // 设置行的高度为100dp
        verticalAlignment = Alignment.CenterVertically // 设置垂直居中
    ) {
        Spacer(modifier = Modifier.weight(100f))
        if(show) {
            MyButton01(
                text = "取消",
                containerColor = MYBLACK_Percent10,
                textColor = MYBLACK,
                size = DpSize(164.px, 44.px),
                shape = RoundedCornerShape(6.px)
            ) {
                onClick2()
            }
            Spacer(modifier = Modifier.width(20.px))
        }
//        MyButton01(
//            alpha = if(selected1) 1.0f else 0.6f ,
//            text = "户型数据",
//            containerColor =  MYBLUE ,
//            textColor = Color.White,
//            size = DpSize(164.px, 44.px),
//            shape = RoundedCornerShape(6.px)
//        ) {
//            onClick2()
//        }
//        Spacer(modifier = Modifier.width(20.px))
        MyButton01(
            alpha = if(selected2) 1.0f else 0.6f ,
            text = "渲染",
            containerColor =  MYBLUE ,
            textColor = Color.White,
            size = DpSize(164.px, 44.px),
            shape = RoundedCornerShape(6.px)
        ) {
            onClick()
        }
    }
}



@Composable
fun Activity.BackButton(onClick: () -> Unit = {}) {
    MyButton01(
        text = "返回",
        containerColor = Color.White,
        textColor = MYBLACK,
        shape = RoundedCornerShape(10.px)
    ) {
        this.finish()
    }
}


@Composable
fun ConfirmButton(
    text: String = "确认",
    size: DpSize = DpSize(148.px, 50.px),
    onClick: () -> Unit
) {
    MyButton01(
        text = text, size = size, textColor = Color.White,
        containerColor = MYBLUE, shape = RoundedCornerShape(10.px)
    ) {
        onClick()
    }
}

/**
 *  使用在查看报价 调整税费
 */
@Composable
fun ConfirmButton2(onClick: () -> Unit) {
    MyButton01(
        text = "确认",
        size = DpSize(160.px, 70.px),
        textColor = Color.White,
        fontSize = 30.mysp,
        containerColor = MYBLUE,
        shape = RoundedCornerShape(10.px)
    ) {
        onClick()
    }
}

/**
 *  使用在查看报价 调整税费
 */
@Composable
fun CancelButton(onClick: () -> Unit) {
    MyButton01(
        text = "取消",
        containerColor = MYBLACK_Percent10,
        textColor = MYBLACK,
        size = DpSize(160.px, 70.px),
        fontSize = 30.mysp,
        shape = RoundedCornerShape(10.px)
    ) {
        onClick()
    }
}


val MyRoundedCornerShape = RoundedCornerShape(
    topStart = 4.dp,
    topEnd = 4.dp,
    bottomStart = 0.dp,
    bottomEnd = 0.dp
)

val MyRoundedCornerShape2 = RoundedCornerShape(
    topStart = 0.dp,
    topEnd = 0.dp,
    bottomStart = 4.dp,
    bottomEnd = 4.dp
)

@Composable
fun DrawScrollableView(modifier: Modifier, content: @Composable () -> Unit) {
    AndroidView(
        modifier = modifier,
        factory = {
            val scrollView = ScrollView(it).apply {
                scrollBarSize = 4
                isVerticalFadingEdgeEnabled = true
                isScrollbarFadingEnabled = false
            }
            val layout = LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)
            scrollView.layoutParams = layout
            scrollView.addView(ComposeView(it).apply {
                setContent {
                    content()
                }
            })
            val linearLayout = LinearLayout(it)
            linearLayout.orientation = LinearLayout.VERTICAL
            linearLayout.layoutParams = LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
            linearLayout.addView(scrollView)
            linearLayout
        }
    )
}

@Composable
fun CustomRadioButton(selected: Boolean, onClick: () -> Unit, size: Dp) {
    Box(
        modifier = Modifier
            .size(size)
            .background(
                if (selected) Color.Blue else Color.Gray, // 外圆圈颜色
                CircleShape
            )
            .clickable { onClick() },
        contentAlignment = Alignment.Center
    ) {
        // 如果选中，显示中心的实心小圆
        if (selected) {
            Box(
                contentAlignment = Alignment.Center,
                modifier = Modifier
                    .size(size * 0.65f) // 实心圆为外圈半径的一半
                    .background(Color.White, CircleShape)
            ) {
                // 实心小圆
                Box(
                    modifier = Modifier
                        .size(size * 0.25f) // 内圆比外圆再小
                        .background(Color.Blue, CircleShape)
                )
            }
        }
    }
}

@Composable
fun CustomRadioButtonDemo2(option: String, selectedOption: MutableState<String>) {
    Column(Modifier.padding(0.dp)) {
        Row(verticalAlignment = Alignment.CenterVertically) {
            CustomRadioButton(
                selected = selectedOption.value == option,
                onClick = { selectedOption.value = option },
                size = 30.px // 自定义 RadioButton 的尺寸
            )
            BasicText(
                text = option,
                style = TextStyle(
                    fontSize = 26.mysp,
                    color = Color(0xFF000000)
                ),
            )
        }
    }
}

/**
 *   支付成功
 */
@Composable
fun MinimalDialog(onDismissRequest: () -> Unit) {
    Dialog(onDismissRequest = { onDismissRequest() }) {
        Box(
            modifier = Modifier
                .background(color = Color.White, shape = RoundedCornerShape(20.px))
                .size(600.px),
            contentAlignment = Alignment.TopCenter // Center the Column
        ) {
            Column(
                horizontalAlignment = Alignment.CenterHorizontally,
                verticalArrangement = Arrangement.Center
            ) {
                Image(
                    painter = painterResource(id = R.drawable.cg),
                    contentDescription = "",
                    modifier = Modifier.size(350.px)
                )
                Text(
                    text = "支付成功",
                    style = TextStyle(
                        color = Color(
                            0xff2C72E5
                        ), fontSize = 30.mysp, fontWeight = FontWeight.Bold
                    )
                )
            }
        }
    }
}


//val GRAY=Color(0x0d333333)

val MYBLUE = Color(0xff2c72e5)

/**
 *   5%的黑色
 */
val MYBLACK_Percent5 = Color(0xff333333).copy(alpha = 0.05f)

/**
 *   10%的黑色
 */
val MYBLACK_Percent10 = Color(0xFF333333).copy(alpha = 0.10f)

/**
 *   40%的黑色
 */
val MYBLACK_Percent40 = Color(0xFF333333).copy(alpha = 0.4f)

/**
 *   60%的黑色
 */
val MYBLACK_Percent60 = Color(0xFF333333).copy(alpha = 0.6f)

/**
 *   80%的黑色
 */
val MYBLACK_Percent80 = Color(0xFF333333).copy(alpha = 0.8f)

/**
 *   60%的白色
 */
val MYWhilte_Percent60 = Color(0xFFFFFFFF).copy(alpha = 0.6f)

/**
 *   40%的白色
 */
val MYWhilte_Percent40 = Color(0xFFFFFFFF).copy(alpha = 0.4f)


val Card = MYWhilte_Percent40

/**
 *  选择户型界面 有使用
 *
 *  黑色字体
 */
val MYBLACK = Color(0xFF333333)

///**
// *  重置按钮的背景色
// */
//val ButtonColor = MYBLACK_Percent10

val MYRED = Color(0xFFF85C5F)

val MyFont_Size = 24.mysp

inline val Int.px: Dp get() = this.dp / 3.5f

inline val Double.px: Dp get() = this.dp / 3.5f

inline val Int.mysp: TextUnit get() = this.sp / 3.5f

//mysp








